﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCCommon;
using BCDto.Common.Dictionary;

namespace BCService.Common.Dictionary
{
    /// <summary>
    /// 字典引用业务接口
    /// </summary>
    public interface IDictionaryReferenceService
    {
        /// <summary>
        ///  新增
        /// </summary>
        Task<int> InsertAsync(DictionaryReferenceRequestDto dto);

        /// <summary>
        /// 修改
        /// </summary>
        Task<int> UpdateAsync(int id, DictionaryReferenceRequestDto dto);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">主键</param>
        Task<int> DeleteAsync(int id);

        /// <summary>
        /// 通过id查询字典数据
        /// </summary>
        /// <param name="dictionaryReferenceId">字典id</param>
        /// <returns></returns>
        Task<DictionaryReferenceDto> GetById(int dictionaryReferenceId);

        /// <summary>
        /// 所有字典数据
        /// </summary>
        /// <returns></returns>
        Task<List<DictionaryReferenceDto>> GetAll();

        /// <summary>
        /// 所有字典数据带分页
        /// </summary>
        Task<PageableList<DictionaryReferenceDto>> PageAll(int pageIndex, int pageSize, bool ascending);
        /// <summary>
        /// 获取字典数据
        /// </summary>
        /// <param name="searchKey">查询Key</param>
        /// <returns></returns>
        Task<DictionaryReferenceDto> GetAsync(string searchKey);
        /// <summary>
        /// 通过检索键查询数据
        /// </summary>
        /// <param name="searchk"></param>
        /// <returns></returns>
        Task<List<DictionaryReferenceDto>> GetBySearchkeyAsync(string searchk);

        /// <summary>
        /// 获取一个类型下的所有字典
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        Task<List<DictionaryReferenceDto>> GetByTypeNameAsync(string typeName);
        /// <summary>
        ///通过一个类型一个父级获取以下所有的字典
        /// </summary>
        /// <param name="typeName">类型名</param>
        /// <param name="parentName">父级名</param>
        /// <returns></returns>
        List<DictionaryReferenceDto> GetByTypeNameAndParentNameAsync(string typeName, string parentName);
        /// <summary>
        /// 通过引用父名称字典数据
        /// </summary>
        /// <param name="parentName"></param>
        /// <returns></returns>
        Task<List<DictionaryReferenceDto>> GetByParentNameAsync(string parentName);

        /// <summary>
        /// 根据索引值和索引列席查询字典
        /// </summary>
        /// <param name="pageIndex">起始页</param>
        /// <param name="pageSize">页数量</param>
        /// <param name="ascending">是否升序排列</param>
        /// <param name="itemValue">索引值</param>
        /// <param name="typeValue">索引类型</param>
        /// <returns></returns>
        Task<PageableList<DictionaryReferenceDto>> GetPageableList(int pageIndex, int pageSize,
            bool ascending, string itemValue, string typeValue);
    }
}